package main

import "fmt"

func main() {
	s4 := make([]int, 0, 5)
	//index out of range [0] with length 0
	//s4[0] = 1
	//直接添加数据
	s4 = append(s4, 2, 3, 4)
	fmt.Println(s4)

	s5 := []int{1, 1, 1, 1}
	s4 = append(s4, s5...)
	fmt.Println(s4)

	//for i遍历
	for i := 0; i < len(s4); i++ {
		fmt.Println(i)
	}

	//s4.for  range遍历
	for _, v := range s4 {
		fmt.Println(v)
	}
}
